package 多线程案例;
//使用定时器
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.PriorityBlockingQueue;

public class Demo_6 {
    public static void main(String[] args) {
        Thread thread = new Thread(()->{
            Timer timer = new Timer();
            timer.schedule(new TimerTask() {
                @Override
                public void run() {
                    System.out.println("111");
                }
            },1000);

            timer.schedule(new TimerTask() {
                @Override
                public void run() {
                    System.out.println("222");
                }
            },2000);

            timer.schedule(new TimerTask() {
                @Override
                public void run() {
                    System.out.println("333");
                }
            },3000);
        });

        thread.start();

        System.out.println("hello");

    }
}